package com.stenio.fancat.vo;

import com.alibaba.fastjson.JSONObject;
import com.stenio.fancat.util.Page;

import lombok.Data;

@Data
public class Result {

	private String code = "0";

	private String msg = "success";

	private Object content;

	/**
	 * 分页信息
	 */
	private Page page;

	public static Result success(Object content) {
		Result result = new Result();
		if (null == content)
			content = new JSONObject();
		result.setContent(content);
		result.setPage(new Page());
		return result;
	}

	public static Result error(String msg) {
		Result result = new Result();
		result.setMsg(msg);
		result.setContent(new JSONObject());
		result.setPage(new Page());
		return result;
	}

	public static Result error(String code, String msg) {
		Result result = new Result();
		result.setContent(new JSONObject());
		result.setPage(new Page());
		result.setCode(code);
		result.setMsg(msg);
		return result;
	}

}
